package com.heima.controller;

import com.heima.dto.UserDto;
import com.heima.service.IUsersService;
import com.heima.vo.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class LonginController {
    @Autowired
    IUsersService usersService;

   @GetMapping("/openId")
    public CommonResult getopenId(@RequestParam String code){

        return CommonResult.success(usersService.getOpenId(code));
    }
    @PostMapping("/register")
    public CommonResult register(@RequestBody UserDto dto){

        return CommonResult.success(usersService.register(dto));
    }

}
